package com.lytoyo.neihanduanzi.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lytoyo.neihanduanzi.model.blog.BlogInfo;
import com.lytoyo.neihanduanzi.service.BlogService;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * Package:com.lytoyo.neihanduanzi.mapper
 *
 * @ClassName:BlogMapper
 * @Create:2025/3/3 12:17
 **/
@Mapper
public interface BlogMapper extends BaseMapper<BlogInfo> {
    /**
     * 添加用户点赞博客信息
     * @param blogId
     * @param userId
     */
    void addBlogLiked(@Param("blogId") Long blogId,@Param("userId") Long userId);

    /**
     * 查询用户是否给博客点过赞
     * @param blogId
     * @param userId
     * @return
     */
    Integer selectIsLiked(@Param("blogId") Long blogId, @Param("userId") Long userId);

    /**
     * 取消点赞
     * @param blogId
     * @param userId
     */
    void cacelLiked(@Param("blogId") Long blogId,@Param("userId") Long userId);

    /**
     * 查询是否曾经有过点赞,然后取消的记录
     * @param blogId
     * @param userId
     * @return
     */
    Integer selectEverIsLiked(@Param("blogId") Long blogId,@Param("userId") Long userId);

    /**
     * 恢复点赞记录
     * @param blogId
     * @param userId
     */
    void recoverLikedRecord(@Param("blogId") Long blogId,@Param("userId") Long userId);

    /**
     * 获取用户的点赞情况
     * @param userId
     * @return
     */
    List<Long> selectLikedState(@Param("userId") Long userId);

    /**
     * 获取用户的收藏情况
     * @param userId
     * @return
     */
    List<Long> selectCollectState(@Param("userId") Long userId);

    /**
     * 获取用户点赞评论情况
     * @param userId
     * @return
     */
    List<Long> selectCommentLikedState(@Param("userId") Long userId);
}
